Skip to content

Minor typed IDs improvements: destructurers, ISpanParsable implementation and V7 Guid generation#813

Merged
Dragemil merged 9 commits intov10.0-previewfrom
feature/minor-typed-ids-improvements
Dec 23, 2025
Merged

Minor typed IDs improvements: destructurers, ISpanParsable implementation and V7 Guid generation#813
Dragemil merged 9 commits intov10.0-previewfrom
feature/minor-typed-ids-improvements

Conversation

@Dragemil
Copy link
Copy Markdown
Contributor

@Dragemil Dragemil commented Dec 23, 2025

@Dragemil Dragemil changed the title Minor typed IDs improvements: destructurers, \ISpanParsable\ implementation and V7 Guid generation Minor typed IDs improvements: destructurers, ISpanParsable implementation and V7 Guid generation Dec 23, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 23, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
912 911 0 1 0 0 1m 51s

Skipped

Tests Status
LeanCode.Azure.Tests.AzureStorageAuditLogIntegrationTests.Ensure_that_all_logs_are_correctly_uploaded_to_multiple_files skipped ⏭️

🎉 No failed tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements ISpanParsable<TSelf> for typed IDs, adds destructuring methods for prefixed IDs, and updates GUID generation to use V7 (time-ordered) GUIDs. The changes modernize the typed ID implementation to support span-based parsing, improve API consistency with IFormatProvider parameters, and add convenient methods to extract components from prefixed IDs.

  • Implementation of ISpanParsable<TSelf> interface with both ReadOnlySpan<char> and string-based parsing methods
  • Addition of Destructure() methods and raw value accessors (Guid, Ulid, ValuePart) for prefixed typed IDs
  • Migration from Guid.NewGuid() to Guid.CreateVersion7() for time-ordered GUID generation

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/Domain/LeanCode.DomainModels.Tests/LeanCode.DomainModels.Tests.csproj Suppresses CA1305 (format provider) warnings for test project
test/Domain/LeanCode.DomainModels.Tests/Ids/RawStringTests.cs Updates tests to use new Parse signature and adds comprehensive span-based parsing tests
test/Domain/LeanCode.DomainModels.Tests/Ids/PrefixedUlidTests.cs Updates tests and adds Destructure test coverage and span-based parsing tests
test/Domain/LeanCode.DomainModels.Tests/Ids/PrefixedStringTests.cs Updates tests for ValuePart property rename and adds Destructure test coverage
test/Domain/LeanCode.DomainModels.Tests/Ids/PrefixedGuidTests.cs Adds tests for Guid property and Destructure method with span-based parsing tests
test/Domain/LeanCode.DomainModels.Tests/Ids/LongTests.cs Adds comprehensive ISpanParsable implementation tests
test/Domain/LeanCode.DomainModels.Tests/Ids/IntTests.cs Adds comprehensive ISpanParsable implementation tests
test/Domain/LeanCode.DomainModels.Tests/Ids/GuidTests.cs Adds comprehensive ISpanParsable implementation tests
src/Helpers/LeanCode.UserIdExtractors/ServiceProviderExtensions.cs Adds ISpanParsable constraint to TBacking generic parameter
src/Helpers/LeanCode.UserIdExtractors/Extractors/RawTypedUserIdExtractor.cs Adds ISpanParsable constraint to TBacking generic parameter
src/Helpers/LeanCode.UserIdExtractors/Extractors/PrefixedTypedUserIdExtractor.cs Updates Parse call to include null IFormatProvider parameter
src/Domain/LeanCode.DomainModels/Ids/TypedIdConverter.cs Updates JSON converter Parse calls to include null IFormatProvider parameter
src/Domain/LeanCode.DomainModels/Ids/ITypedId.cs Adds ISpanParsable interface and removes redundant static Parse method declarations
src/Domain/LeanCode.DomainModels.Generators/TypedIdGenerator.cs Adds using statement for SourceBuilders namespace
src/Domain/LeanCode.DomainModels.Generators/SourceBuilders/RawStringIdSourceBuilder.cs New file with ISpanParsable implementation for raw string IDs
src/Domain/LeanCode.DomainModels.Generators/SourceBuilders/RawIdSourceBuilder.cs New file with ISpanParsable implementation for raw typed IDs (int, long, Guid)
src/Domain/LeanCode.DomainModels.Generators/SourceBuilders/PrefixedUlidIdSourceBuilder.cs New file with ISpanParsable, Destructure method, and Ulid property for prefixed ULID IDs
src/Domain/LeanCode.DomainModels.Generators/SourceBuilders/PrefixedStringIdSourceBuilder.cs New file with ISpanParsable, Destructure method, and ValuePart property for prefixed string IDs
src/Domain/LeanCode.DomainModels.Generators/SourceBuilders/PrefixedGuidIdSourceBuilder.cs New file with ISpanParsable, Destructure method, V7 Guid generation, and Guid property
src/Domain/LeanCode.DomainModels.Generators/SourceBuilders/IdSource.cs Refactored IdSource with V7 Guid generation support
src/Domain/LeanCode.DomainModels.Generators/IdSource.cs Removed old IdSource file (refactored into SourceBuilders directory)
src/Domain/LeanCode.DomainModels.EF/TypedIdConverter.cs Adds ISpanParsable constraint to TBacking generic parameter
src/Domain/LeanCode.DomainModels.EF/PropertiesConfigurationBuilderExtensions.cs Adds ISpanParsable constraint to TBacking generic parameter
docs/domain/id/index.md Documents new ISpanParsable interface, prefixed ID features, and updated API surface
CHANGELOG.md Documents the ISpanParsable implementation and Destructure method additions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 99.60887% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.60%. Comparing base (0b01449) to head (36e3571).

Files with missing lines Patch % Lines
...DomainModels.Generators/SourceBuilders/IdSource.cs 94.87% 1 Missing and 1 partial ⚠️
...main/LeanCode.DomainModels/Ids/TypedIdConverter.cs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           v10.0-preview     #813      +/-   ##
=================================================
+ Coverage          81.36%   84.60%   +3.23%     
=================================================
  Files                231      236       +5     
  Lines               4648     4814     +166     
  Branches             345      342       -3     
=================================================
+ Hits                3782     4073     +291     
+ Misses               783      658     -125     
  Partials              83       83              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dragemil Dragemil force-pushed the feature/minor-typed-ids-improvements branch from be9c9d1 to 9dbea26 Compare December 23, 2025 12:42
@Dragemil Dragemil force-pushed the feature/minor-typed-ids-improvements branch from 9dbea26 to 36e3571 Compare December 23, 2025 12:43
@Dragemil Dragemil merged commit d543f4d into v10.0-preview Dec 23, 2025
9 checks passed
@Dragemil Dragemil deleted the feature/minor-typed-ids-improvements branch December 23, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants